package org.phantom.securityframework.local;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.SqlSession;
import org.phantom.securityframework.api.Resource;
import org.phantom.securityframework.api.ResourceManager;
import org.phantom.securityframework.auth.realm.ResourceRealm;
import org.springframework.stereotype.Service;


@Service
public class ResourceManagerLocalImpl implements ResourceManager,ResourceRealm{

	@javax.annotation.Resource
	private SqlSession session = null;
	@Override
	public void add(Resource resource) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void addAll(Resource[] resources) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public List<Resource> list() {
		// TODO Auto-generated method stub
		return null;
	}


	@Override
	public Resource get(int id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Resource get(String res) {
		// TODO Auto-generated method stub
		return null;
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Resource> loadSubsystemPermission(String platform,String subsystem) {
		Map<String,String> param = new HashMap<String,String>();
		param.put("platformId", platform);
		param.put("subsystemId", subsystem);
		return session.selectList("org.phantom.securityframework.ResourceMapper.listResources",param);
	}

}